<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>juqery选择器</title>
  <script src="./js/jquery.js"></script>
  <style>
    * {
      padding: 0;
      margin: 0;
    }

    body,
    html {
      height: 100%;
    }

    body::before {
      height: 0;
      content: "";
      display: block;
    }

    div {
      width: 150px;
      height: 100px;
      background-color: pink;
      display: inline-block;
      vertical-align: top;
    }

    div:not(:last-of-type) {
      margin-right: 10px;
    }

    .cls {
      border: 2px solid red;
    }
  </style>
</head>
<!-- 
  内容选择器
    :contains(text)
      找到包含指定文本内容的指定元素
    :empty
      找到既没有文本内容也没子元素的指定元素
    :has(selector)
      找到包含指定元素的子元素
    :parent
      找到有文本内容或有子元素的指定元素
 -->

<body>
  <div></div>
  <div>我是div</div>
  <div>他们我是div123</div>
  <div><span></span></div>
  <div>
    <p></p>
  </div>
</body>
<script>
  "use strict";
  $(function () {
    let $div1 = $("div:empty");
    console.log($div1);
    let $div2 = $("div:parent");
    console.log($div2);
    let $div3 = $(`div:contains("我是")`);
    console.log($div3);
    let $div4 = $(`div:has("span")`);
    console.log($div4);
  });
</script>

</html>